home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / 80X86 / DOS32V33.ZIP / EXAMPLES / CEXAMPLE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-20  |  1.8 KB  |  80 lines

  1. /*************************************************************************
  2.             CEXAMPLE.C:         small example C program using PAL.
  3.  
  4. to compile using Borland C V4.0+
  5.  
  6.         bcc32 -c cexample.c
  7.         dlink -c cexample.obj c0.obj ,,, pal.lib
  8.  
  9. where;
  10. pal.lib  = standard library
  11. c0.obj   = startup code
  12.  
  13.  
  14.  
  15.  
  16.  
  17. *************************************************************************/
  18.  
  19. #include    <stdio.h>
  20.  
  21.  
  22.  
  23.     char    *s;
  24.     char  **ss;
  25.     char      c;
  26.     unsigned i,n;
  27.         unsigned char *video_pointer;
  28.  
  29.  
  30.  
  31. int main(int argc, char *argv[])
  32. {
  33.  
  34. char * system;
  35.  
  36.        *(int*)&video_pointer = 0xA0000 - (int)_zero;
  37.  
  38.  
  39.     printf("C example program using PAL.LIB for the standard library.\n\n");
  40.  
  41.     if (dos32system == 1) system="raw DOS";
  42.     if (dos32system == 2) system="XMS";
  43.     if (dos32system == 4) system="VCPI";
  44.     if (dos32system == 8) system="DPMI";
  45.  
  46.  
  47.  
  48.     fprintf(stdout," Executable file name           %s\n",argv[0]);
  49.     fprintf(stderr," Executable file name           %s\n",argv[0]);
  50.     printf(" Executable file size           %d bytes\n",exesize);
  51.     printf(" Number of command line args    %d\n",argc);
  52.     for (i=0; i < argc; i++ ){
  53.      printf(" arg %d '%s'\n",i,argv[i]);
  54.  
  55.     }
  56.  
  57.     printf(" System type                    %s\n",system);
  58.     printf(" DOS32 Version                  %x.%x%x\n",dos32version >> 8,(dos32version >> 4) & 0xF,dos32version & 0xF);
  59.     printf(" Avalible memory                %dK\n",maxavail()>>10);
  60.  
  61.  
  62. /**** display the environment ********/
  63. /*       for (i=(ulong)environ ; ; i += sizeof (char *))
  64.       {
  65.         s = *(char **)i;
  66.         if ( *s == 0 ) break;
  67.     printf("%s \n",s);
  68.       } */
  69.  
  70.  
  71.     printf("\nPress any key to exit\n");
  72.     for (; !kbhit() ;); 
  73.        getchar();
  74.  
  75.  
  76.  
  77.  
  78. return EXIT_SUCCESS;
  79. }
  80.